package com.hsmw.api.exception;

import com.htn.common.core.constant.CommonConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author WD
 * @version 1.0
 * @description: TODO
 * @date 2021/1/26 14:01
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ApiException extends RuntimeException {

	private CommonConstants.ResponseStatus responseStatus;
	private Integer code;
	private String message;


	public ApiException(CommonConstants.ResponseStatus responseStatus) {
		this.responseStatus = responseStatus;
		this.message = responseStatus.getMessage();
		this.code = responseStatus.getCode();
	}

	public ApiException(String message) {
		code = CommonConstants.ResponseStatus.FAIL.getCode();
		this.message = message;
	}


}
